package com.sailmi.oss.provider.localfileoss.support;


import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Properties;


public class LocalFileProperties implements InitializingBean {

    private String storePath;
	public LocalFileProperties(){
		Properties props = new Properties();
		try {
			props.load(LocalFileProperties.class.getResourceAsStream("/localfileoss.properties"));
			storePath = (String) props.get("storePath");
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

    public String getStorePath() {
        return storePath;
    }

    public void setStorePath(String storePath) {
        this.storePath = storePath;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        Assert.notNull(storePath,"存储路径不能为空！");
    }

}
